﻿using System;
using System.IO;
using System.Net;

namespace Dotnet.Utils.Utility
{
    public class EnvironmentPathUtil
    {
        public static string GetSystemPath(string subPath)
        {
            string text = AppDomain.CurrentDomain.BaseDirectory;
            if (!string.IsNullOrEmpty(subPath))
            {
                text = Path.Combine(text, subPath);
            }
            return text;
        }

        private static string GetDesktopPath()
        {
            return Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
        }

        private static string GetWindowsPath()
        {
            return Environment.GetFolderPath(Environment.SpecialFolder.Windows);
        }

        public static string GetIp()
        {
            string result;
            IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName());
            IPAddress ipaddress = hostEntry.AddressList[0];
            result = ipaddress.ToString();
            return result;
        }
    }
}